set more off 

** PAPER **

*****************
* MAIN ANALYSES * 
*****************

* TABLE 1, MODEL 1 - ALL STATES NO INTERACTION
xtlogit domattackyn i.lagdiscrmyn i.lagdomyn  c.laglogigcppc c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0, re i(ccode)
sum lagdiscrmyn lagdomyn  laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins, at(laglogipopden =(1.019149 3.941098)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.331339 -1.255619)) predict(pu0) atmeans
margins, at(laglogbdist1 =(5.511217 7.057521)) predict(pu0) atmeans
margins, at(laglogcapdist =(6.997004 8.118538)) predict(pu0) atmeans
margins lagcivconf, predict(pu0) atmeans 

* TABLE 1, MODEL 2 - DEMOCRACIES NO INTERACTION
xtlogit domattackyn i.lagdiscrmyn i.lagdomyn c.laglogigcppc c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=., re i(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 lagcivconf if e(sample)==1, d
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins, at(laglogipopden =(.8105771 3.8286201)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.429638 -1.366914)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.577365 7.081806)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

* TABLE 1, MODEL 3 - ALL STATES, INTERACTION
xtlogit domattackyn i.lagdiscrmyn i.lagdomyn c.laglogigcppc i.lagdiscrmyn#c.laglogigcppc c.laglogipopden i.lagdiscrmyn#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0, re i(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 lagcivconf if e(sample)==1, d
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans 
margins lagdiscrmyn, at (laglogigcppc=(0 (2) 14)) predict(pu0) atmeans
marginsplot
margins, at(laglogipopden =(1.019149 3.941098)) predict(pu0) atmeans
margins lagdiscrmyn, at (laglogipopden=(-8 (2) 10)) predict(pu0) atmeans
marginsplot
margins, at(laglogmnt =(-5.331339 -1.255619)) predict(pu0) atmeans
margins, at(laglogbdist1 =(5.511217 7.057521)) predict(pu0) atmeans
margins, at(laglogcapdist =(6.997004 8.118538)) predict(pu0) atmeans
margins lagcivconf, predict(pu0) atmeans 

* TABLE 1, MODEL 4 - DEMOCRACIES INTERACTION
xtlogit domattackyn i.lagdiscrmyn i.lagdomyn c.laglogigcppc i.lagdiscrmyn#c.laglogigcppc c.laglogipopden i.lagdiscrmyn#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=., re i(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins lagdiscrmyn, at (laglogigcppc=(0 (2) 12))
marginsplot
margins, at(laglogigcppc =(9.257393 10.383499)) predict(pu0) atmeans 
margins, at(laglogipopden =(.8105771 3.8286201)) predict(pu0) atmeans
margins lagdiscrmyn, at (laglogipopden=(-8 (2) 10))
marginsplot
margins, at(laglogmnt =(-5.429638 -1.366914)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.577365 7.081806)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

************
* APPENDIX *
************

** HAVING IRRELEVANT GROUPS TREATED AS POWERSHARING; LAGDOMYN2, LAGDISCRMYN2, LAGPWRSHYN2 **

* APPENDIX TABLE 1, MODEL 1 - ALL STATES NO INTERACTION
xtlogit domattackyn i.lagdiscrmyn2 i.lagdomyn2 c.laglogigcppc c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3, re i(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 2, MODEL 1 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn2, predict(pu0) atmeans
margins lagdomyn2, predict(pu0) atmeans
margins, at(laglogipopden =(1.014865 3.905001)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.381979 -1.315384)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.443727 6.983391)) predict(pu0) atmeans 
margins, at(laglogcapdist =(6.941163 8.052757)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

* APPENDIX TABLE 1, MODEL 2 - DEMOCRACIES NO INTERACTION
xtlogit domattackyn i.lagdiscrmyn2 i.lagdomyn2 c.laglogigcppc c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=., re i(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 2, MODEL 2 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn2, predict(pu0) atmeans
margins lagdomyn2, predict(pu0) atmeans
margins, at(laglogigcppc =(9.289939 10.425288)) predict(pu0) atmeans
margins, at(laglogipopden =(.7849694 3.8493704)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.469381 -1.422585)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.543172 7.054854)) predict(pu0) atmeans 
margins, at(laglogcapdist =(7.006215 8.232515)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

* APPENDIX TABLE 1, MODEL 3 - ALL STATES, INTERACTION
xtlogit domattackyn i.lagdiscrmyn2 i.lagdomyn2 c.laglogigcppc i.lagdiscrmyn2#c.laglogigcppc c.laglogipopden i.lagdiscrmyn2#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0, re i(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 2, MODEL 3 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn2, predict(pu0) atmeans
margins lagdomyn2, predict(pu0) atmeans
margins lagdiscrmyn2, at (laglogigcppc=(0 (2) 14)) predict(pu0) atmeans 
marginsplot
* FIGURE 1A
margins, at(laglogipopden =(1.014865 3.905001)) predict(pu0) atmeans
margins lagdiscrmyn2, at (laglogipopden=(-8 (2) 10)) predict(pu0) atmeans 
marginsplot
* FIGURE 2A
margins, at(laglogmnt =(-5.381979 -1.315384)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.443727 6.983391)) predict(pu0) atmeans 
margins, at(laglogcapdist =(6.941163 8.052757)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

* APPENDIX TABLE 1, MODEL 4 - DEMOCRACIES INTERACTION
xtlogit domattackyn i.lagdiscrmyn2 i.lagdomyn2 c.laglogigcppc i.lagdiscrmyn2#c.laglogigcppc c.laglogipopden i.lagdiscrmyn2#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=., re i(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 2, MODEL 4 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn2, predict(pu0) atmeans
margins lagdomyn2, predict(pu0) atmeans
margins lagdiscrmyn2, at (laglogigcppc=(0 (2) 12)) predict(pu0) atmeans 
marginsplot
* FIGURE 1B
margins, at(laglogigcppc =(9.289939 10.425288)) predict(pu0) atmeans
margins, at(laglogipopden =(.7849694 3.8493704)) predict(pu0) atmeans
margins lagdiscrmyn2, at (laglogipopden=(-8 (2) 10)) predict(pu0) atmeans 
marginsplot
* FIGURE 2B
margins, at(laglogmnt =(-5.469381 -1.422585)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.543172 7.054854)) predict(pu0) atmeans 
margins, at(laglogcapdist =(7.006215 8.232515)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

** NIGHTLIGHTS **

* APPENDIX TABLE 3, MODEL 1 - Model 1 * ALL STATES NO INTERACTION
xtlogit domattackyn lagdomattacksplag i.lagdomyn i.lagdiscrmyn c.laglognlights c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0, re i(ccode)
sum lagdomyn lagdiscrmyn laglognlights laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 4, MODEL 1 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins, at(laglognlights =(-3.138649 -2.4917619)) predict(pu0) atmeans
margins, at(laglogipopden =(1.148557 4.030457)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.288222 -1.207445)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.447449 6.988654)) predict(pu0) atmeans 
margins, at(laglogcapdist =(6.949901 8.075648)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

* APPENDIX TABLE 3, MODEL 2 * DEMS NO INTERACTION
xtlogit domattackyn lagdomattacksplag i.lagdomyn i.lagdiscrmyn c.laglognlights c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=., re i(ccode)
sum lagdiscrmyn lagdomyn laglognlights laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 4, MODEL 2 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins, at(laglognlights =(-3.052049 -2.3596324)) predict(pu0) atmeans
margins, at(laglogipopden =(.8407704 3.8291474)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.427787 -1.363175)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.578725 7.085824)) predict(pu0) atmeans 
margins, at(laglogcapdist =(7.051661 8.173558)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

* APPENDIX TABLE 3, MODEL 3 * ALL STATES INTERACTION
xtlogit domattackyn lagdomattacksplag i.lagdiscrmyn#c.laglognlights i.lagdiscrmyn#c.laglogipopden i.lagdiscrmyn laglognlights laglogmnt laglogipopden laglogbdist1 laglogcapdist i.lagdomyn i.lagcivconf lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0, re i(ccode)
sum lagdomyn lagdiscrmyn laglognlights laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 4, MODEL 3 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins lagdiscrmyn, at (laglognlights=(-4 (.5) 0)) predict(pu0)
marginsplot
* FIGURE 3A
margins, at(laglognlights =(-3.138649 -2.4917619)) predict(pu0) atmeans
margins, at(laglogipopden =(1.148557 4.030457)) predict(pu0) atmeans
margins lagdiscrmyn, at (laglogipopden=(-8 (2) 10)) predict(pu0)
marginsplot
* FIGURE 4A 
margins, at(laglogmnt =(-5.288222 -1.207445)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.447449 6.988654)) predict(pu0) atmeans 
margins, at(laglogcapdist =(6.949901 8.075648)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

* APPENDIX TABLE 3, MODEL 4 * DEMS INTERACTION
xtlogit domattackyn lagdomattacksplag i.lagdiscrmyn#c.laglognlights i.lagdiscrmyn#c.laglogipopden i.lagdiscrmyn laglognlights laglogmnt laglogipopden laglogbdist1 laglogcapdist i.lagdomyn i.lagcivconf lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=., re i(ccode)
sum lagdiscrmyn lagdomyn laglognlights laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 4, MODEL 4 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins lagdiscrmyn, at (laglognlights=(-4 (.5) 0)) predict(pu0)
marginsplot
* FIGURE 3B
margins, at(laglognlights =(-3.052049 -2.3596324)) predict(pu0) atmeans
margins, at(laglogipopden =(.8407704 3.8291474)) predict(pu0) atmeans
margins lagdiscrmyn, at (laglogipopden=(-8 (2) 10)) predict(pu0)
marginsplot
* FIGURE 4B
margins, at(laglogmnt =(-5.427787 -1.363175)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.578725 7.085824)) predict(pu0) atmeans 
margins, at(laglogcapdist =(7.051661 8.173558)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

** NBREG w/GCP ** 
 
* APPENDIX TABLE 5, MODEL 1 * ALL STATES NO INTERACTION
xtnbreg domattack lagdomattacksplag i.lagdomyn i.lagdiscrmyn c.laglogigcppc c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0, re i(ccode)

* APPENDIX TABLE 5, MODEL 2 * DEMS NO INTERACTION
xtnbreg domattack lagdomattacksplag i.lagdomyn i.lagdiscrmyn c.laglogigcppc c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=., re i(ccode)

* APPENDIX TABLE 5, MODEL 3 * ALL STATES W/INTERACTION
xtnbreg domattack lagdomattacksplag i.lagdomyn i.lagdiscrmyn c.laglogigcppc i.lagdiscrmyn#c.laglogigcppc laglogipopden i.lagdiscrmyn#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 , re i(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d

* APPENDIX TABLE 5, MODEL 4 * DEMS W/INTERACTION
xtnbreg domattack lagdomattacksplag i.lagdomyn i.lagdiscrmyn c.laglogigcppc i.lagdiscrmyn#c.laglogigcppc laglogipopden i.lagdiscrmyn#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=., re i(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d

** ZINB **

* APPENDIX TABLE 5, MODEL 5 - ALL STATES NO INTERACTION 
zinb domattack i.lagdiscrmyn i.lagdomyn c.laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdompeaceyrs lagdomattacksplag _lagspline1 _lagspline2 _lagspline3, inflate (laglogigcppc laglogipop) robust cluster(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins, at(laglogigcppc =(8.860843 10.145501)) predict(pu0) atmeans
margins, at(laglogipopden =(1.019149 3.941098)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.331339 -1.255619)) predict(pu0) atmeans
margins, at(laglogbdist1 =(5.511217 7.057521)) predict(pu0) atmeans
margins, at(laglogcapdist =(6.997004 8.118538)) predict(pu0) atmeans
margins lagcivconf, predict(pu0) atmeans 

* APPENDIX TABLE 5, MODEL 6 - DEMS NO INTERACTION 
zinb domattack i.lagdiscrmyn i.lagdomyn c.laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdompeaceyrs lagdomattacksplag _lagspline1 _lagspline2 _lagspline3 if lagpolity2>5 & lagpolity2!=., inflate (laglogigcppc laglogipop) robust cluster(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins, at(laglogipopden =(.8105771 3.8286201)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.429638 -1.366914)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.577365 7.081806)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

* APPENDIX TABLE 5, MODEL 7 - ALL STATES INTERACTION 
zinb domattack i.lagdiscrmyn i.lagdomyn c.laglogigcppc i.lagdiscrmyn2#c.laglogigcppc laglogipopden i.lagdiscrmyn2#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdompeaceyrs lagdomattacksplag _lagspline1 _lagspline2 _lagspline3, inflate (laglogigcppc laglogipop) robust cluster(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
* TABLE 6
margins lagdiscrmyn, at (laglogigcppc=(0 (2) 12)) predict(pu0)
marginsplot
* FIGURE 7A
margins, at(laglogigcppc =(8.860843 10.145501)) predict(pu0) atmeans
* TABLE 7
margins lagdiscrmyn, at (laglogipopden=(-8 (2) 10)) 
marginsplot
* FIGURE 8A
margins, at(laglogipopden =(1.019149 3.941098)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.331339 -1.255619)) predict(pu0) atmeans
margins, at(laglogbdist1 =(5.511217 7.057521)) predict(pu0) atmeans
margins, at(laglogcapdist =(6.997004 8.118538)) predict(pu0) atmeans
margins lagcivconf, predict(pu0) atmeans 

* APPENDIX TABLE 5, MODEL 8 - DEMS INTERACTION 
zinb domattack i.lagdiscrmyn i.lagdomyn c.laglogigcppc i.lagdiscrmyn2#c.laglogigcppc laglogipopden i.lagdiscrmyn2#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdompeaceyrs lagdomattacksplag _lagspline1 _lagspline2 _lagspline3 if lagpolity2>5 & lagpolity2!=., inflate (laglogigcppc laglogipop) robust cluster(ccode)
sum lagdiscrmyn lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
* TABLE 6
margins lagdiscrmyn, at (laglogigcppc=(0 (2) 12)) 
marginsplot
* FIGURE 7B
margins, at(laglogipopden =(.8105771 3.8286201)) predict(pu0) atmeans
* TABLE 7
margins lagdiscrmyn, at (laglogipopden=(-8 (2) 10)) 
marginsplot
* FIGURE 8B
margins, at(laglogmnt =(-5.429638 -1.366914)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.577365 7.081806)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

** EXCLUDING CIVIL WAR **

* APPENDIX TABLE 8, MODEL 1 - ALL STATES NO INTERACTION
xtlogit domattackyn i.lagdiscrmyn i.lagdomyn c.laglogigcppc c.laglogipopden laglogmnt laglogbdist1 laglogcapdist lagdompeaceyrs lagdomattacksplag _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagcivconf==0, re i(ccode)
sum lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 9, MODEL 1 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins, at(laglogigcppc =(8.860843 10.145501)) predict(pu0) atmeans
margins, at(laglogipopden =(.8390935 3.7416765)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.402035 -1.329149)) predict(pu0) atmeans
margins, at(laglogbdist1 =(5.546868 7.095144)) predict(pu0) atmeans
margins, at(laglogcapdist =(7.051959 8.17606)) predict(pu0) atmeans

* APPENDIX TABLE 8, MODEL 2 - DEMOCRACIES NO INTERACTION
xtlogit domattackyn i.lagdiscrmyn i.lagdomyn c.laglogigcppc c.laglogipopden laglogmnt laglogbdist1 laglogcapdist lagdompeaceyrs lagdomattacksplag _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagcivconf==0 & lagpolity2>5 & lagpolity2!=. & lagcivconf==0, re i(ccode)
sum lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 9, MODEL 2 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins, at(laglogipopden =(.613232 3.558543)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.481657 -1.420053)) predict(pu0) atmeans
margins, at(laglogbdist1 =(5.593164 7.096615)) predict(pu0) atmeans
margins, at(laglogcapdist =(7.088811 8.213873)) predict(pu0) atmeans

* APPENDIX TABLE 8, MODEL 3 - ALL STATES INTERACTION
xtlogit domattackyn i.lagdiscrmyn i.lagdomyn c.laglogigcppc i.lagdiscrmyn#c.laglogigcppc laglogipopden i.lagdiscrmyn#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist lagdompeaceyrs lagdomattacksplag _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagcivconf==0, re i(ccode)
sum lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 9, MODEL 3 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins lagdiscrmyn, at (laglogigcppc=(0 (2) 14))
marginsplot
* FIGURE 9A
margins, at(laglogigcppc =(8.860843 10.145501)) predict(pu0) atmeans
margins, at(laglogipopden =(.8390935 3.7416765)) predict(pu0) atmeans
margins lagdiscrmyn, at (laglogipopden=(-8 (2) 10))
marginsplot
* FIGURE 10A
margins, at(laglogmnt =(-5.402035 -1.329149)) predict(pu0) atmeans
margins, at(laglogbdist1 =(5.546868 7.095144)) predict(pu0) atmeans
margins, at(laglogcapdist =(7.051959 8.17606)) predict(pu0) atmeans

* APPENDIX TABLE 8, MODEL 4 - DEMOCRACIES INTERACTION
xtlogit domattackyn i.lagdiscrmyn i.lagdomyn c.laglogigcppc i.lagdiscrmyn#c.laglogigcppc laglogipopden i.lagdiscrmyn#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist lagdompeaceyrs lagdomattacksplag _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=. & lagcivconf==0, re i(ccode)
sum lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 9, MODEL 4 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins lagdiscrmyn, at (laglogigcppc=(0 (2) 14))
marginsplot
* FIGURE 9B
margins, at(laglogigcppc =(9.335935 10.428455)) predict(pu0) atmeans
margins, at(laglogipopden =(.613232 3.558543)) predict(pu0) atmeans
margins lagdiscrmyn, at (laglogipopden=(-8 (2) 10))
marginsplot
* FIGURE 10B
margins, at(laglogmnt =(-5.481657 -1.420053)) predict(pu0) atmeans
margins, at(laglogbdist1 =(5.593164 7.096615)) predict(pu0) atmeans
margins, at(laglogcapdist =(7.088811 8.213873)) predict(pu0) atmeans

** USING DOUBTTERR **

* APPENDIX TABLE 10, MODEL 1 - ALL STATES NO INTERACTION
xtlogit domattackyn2 i.lagdiscrmyn i.lagdomyn  c.laglogigcppc c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0, re i(ccode)
sum lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 11, MODEL 1 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins, at(laglogigcppc =(8.857615 10.145178)) predict(pu0) atmeans
margins, at(laglogipopden =(1.017516 3.935124)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.331061 -1.255203)) predict(pu0) atmeans
margins, at(laglogbdist1 =(5.510694 7.057036)) predict(pu0) atmeans
margins, at(laglogcapdist =(6.997012 8.118618)) predict(pu0) atmeans
margins lagcivconf, predict(pu0) atmeans 

* APPENDIX TABLE 10, MODEL 2 - DEMOCRACIES NO INTERACTION
xtlogit domattackyn2 i.lagdiscrmyn i.lagdomyn c.laglogigcppc c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=., re i(ccode)
sum lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 lagcivconf if e(sample)==1, d
* TABLE 11, MODEL 2 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins, at(laglogigcppc =(9.247147 10.379819)) predict(pu0) atmeans
margins, at(laglogipopden =(.8239663 3.8408413)) predict(pu0) atmeans
margins, at(laglogmnt =(-5.432718 -1.371528)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.565837 7.070916)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans

* APPENDIX TABLE 10, MODEL 3 - ALL STATES, INTERACTION
xtlogit domattackyn2 i.lagdiscrmyn i.lagdomyn c.laglogigcppc i.lagdiscrmyn#c.laglogigcppc c.laglogipopden i.lagdiscrmyn#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0, re i(ccode)
sum lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 11, MODEL 3 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans 
margins lagdiscrmyn, at (laglogigcppc=(0 (2) 14)) predict(pu0) atmeans
marginsplot
* FIGURE 11A
margins, at(laglogipopden =(1.017516 3.935124)) predict(pu0) atmeans
margins lagdiscrmyn, at (laglogipopden=(-8 (2) 10)) predict(pu0) atmeans
marginsplot
* FIGURE 12A
margins, at(laglogmnt =(-5.331061 -1.255203)) predict(pu0) atmeans
margins, at(laglogbdist1 =(5.510694 7.057036)) predict(pu0) atmeans
margins, at(laglogcapdist =(6.997012 8.118618)) predict(pu0) atmeans
margins lagcivconf, predict(pu0) atmeans 

* APPENDIX TABLE 10, MODEL 4 - DEMOCRACIES INTERACTION
xtlogit domattackyn2 i.lagdiscrmyn i.lagdomyn c.laglogigcppc i.lagdiscrmyn#c.laglogigcppc c.laglogipopden i.lagdiscrmyn#c.laglogipopden laglogmnt laglogbdist1 laglogcapdist i.lagcivconf lagdomattacksplag lagdompeaceyrs _lagspline1 _lagspline2 _lagspline3 if lagipop!=0 & lagpolity2>5 & lagpolity2!=., re i(ccode)
sum lagdiscrmyn lagdomyn laglogigcppc laglogipopden laglogmnt laglogbdist1 laglogcapdist lagcivconf if e(sample)==1, d
* TABLE 11, MODEL 4 MARGINAL EFFECTS
margins, predict(pu0) atmeans
margins lagdiscrmyn, predict(pu0) atmeans
margins lagdomyn, predict(pu0) atmeans
margins lagdiscrmyn, at (laglogigcppc=(0 (2) 12))
marginsplot
* FIGURE 11B
margins, at(laglogigcppc =(9.247147 10.379819)) predict(pu0) atmeans 
margins, at(laglogipopden =(.8239663 3.8408413)) predict(pu0) atmeans
margins lagdiscrmyn, at (laglogipopden=(-8 (2) 10))
marginsplot
* FIGURE 12B
margins, at(laglogmnt =(-5.432718 -1.371528)) predict(pu0) atmeans 
margins, at(laglogbdist1 =(5.565837 7.070916)) predict(pu0) atmeans 
margins lagcivconf, predict(pu0) atmeans
